<?php

namespace App\Http\Requests;

use App\Models\StatusCode;
use App\Services\CommonReturn;

class FilesRequest extends CommonRequest
{
    public $file_type = 'file';//文件类型:file image
    public $file_name = 'file';//form表单上传的input name
    public $save_dir = 'file';//文件存储的路径

    /**
     * Description:  rules
     * @author: JiaMeng <666@majiameng.com>
     * Updater:
     * @return array
     */
    public function rules()
    {
        $this->save_dir = $this->get('name','default');
        return [
            $this->file_name => 'required',
        ];
    }

    /**
     * Description:  messages
     * @author: JiaMeng <666@majiameng.com>
     * Updater:
     * @return array
     */
    public function messages()
    {
        return [
            $this->file_name.'.required'=>'请选择文件',
            $this->file_name.'.file'=>'文件格式不正确',
            $this->file_name.'.image'=>'图片格式不正确',
        ];
    }

}
